﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Medianamik.Core.DAL.SQL
{
    public class RowNumberQuery : ISqlQueryPart 
    {
        public RowNumberSelectClause SelectClause
        {
            get; private set;
        }
        public FromClause FromClause
        {
            get;
            private set;
        }
        public WhereClause WhereClause
        {
            get;
            private set;
        }
        public GroupByClause GroupByClause
        {
            get;
            private set;
        }
        public RowNumberQuery(RowNumberSelectClause pSelect, FromClause pFrom, WhereClause pWhere, GroupByClause pGroupBy  )
        {
            SelectClause = pSelect;
            FromClause = pFrom;
            WhereClause = pWhere;
            GroupByClause = pGroupBy;
        }

        public StringBuilder ToSQL()
        {
            return SelectClause.ToSQL()
                .Append(FromClause.ToSQL())
                .Append(WhereClause.ToSQL())
                .Append(GroupByClause.ToSQL());
        }
    }
}
